package org.example.controller;

import org.example.zerenlian.chain.dto.ClothsDTO;
import org.example.zerenlian.chain.dto.DrinkDTO;
import org.example.zerenlian.chain.dto.VirtualDTO;
import org.example.zerenlian.chain.enums.ChainEnums;
import org.example.zerenlian.chain.service.ChainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author czj
 * @date 2024/12/7
 * @description
 */
@RestController
public class ChainController {

    @Autowired
    private ChainService chainService;


    @RequestMapping("/cloths")
    public String cloths(@RequestBody ClothsDTO clothsDTO){
        chainService.process(ChainEnums.CLOTHES, clothsDTO);
        return "success";
    }

    @RequestMapping("/drink")
    public String drink(@RequestBody DrinkDTO drinkDTO){
        chainService.process(ChainEnums.DRINK, drinkDTO);
        return "success";
    }

    @RequestMapping("/virtual")
    public String virtual(@RequestBody VirtualDTO virtualDTO) {
        chainService.process(ChainEnums.VIR, virtualDTO);
        return "success";
    }
}
